#include "dialogconfig.h"
#include "ui_dialogconfig.h"
#include <QDateTime>


DialogConfig::DialogConfig(QWidget *parent) :
    QDialog(parent),
    ui(new Ui::DialogConfig)
{
    ui->setupUi(this);

    connect( ui->useSystemDateButton, SIGNAL(clicked()), this, SLOT(onUseSystemDate()));
}

DialogConfig::~DialogConfig()
{
    delete ui;
}


void DialogConfig::onUseSystemDate()
{
    QDateTime t=QDateTime::currentDateTime();
    ui->dateEdit->setDate(t.date());
    ui->timeEdit->setTime(t.time());
}

QDateTime DialogConfig::dateTime()
{
    return QDateTime(ui->dateEdit->date(),ui->timeEdit->time());
}

uint8_t DialogConfig::refreshTime()
{
    return uint8_t(ui->refreshTime->value());
}
